import configparser
from pathlib import Path
import json
filename = Path('test.ini')
cfg = configparser.ConfigParser()
cfg.read(filename)
d = {}
for i in cfg.items():
    d.setdefault(i[0],dict(cfg.items(i[0])))
with open('test.json','w') as f:
    json.dump(d,f,indent = 4,sort_keys = True)


# 不错
